﻿<%@ Page Language="C#" MasterPageFile="~/admin/Admin.Master" AutoEventWireup="true"
    Codebehind="userList.aspx.cs" Inherits="CMS.admin.userList" Title="Hệ thống quản trị nội dung - Quản lý người dùng" %>

<%@ Register Assembly="ComponentArt.Web.UI" Namespace="ComponentArt.Web.UI" TagPrefix="ComponentArt" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <script type="text/javascript">
     
      function deleteRow(rowId)
      {           
        Grd1.Delete(Grd1.GetRowFromClientId(rowId));
      }   									   
   	
    </script>

    <div style="border: solid 1px #ccc;">
        <div id="toolbox">
            <div class="header" style="float: left; margin-left: -40px;">
                <img src="../images/Toolbox/icon-48-article-add.png" alt="" id="imgHeader" />
                Quản lý người dùng: danh sách
            </div>
            <div style="float: right;">
                <table class="toolbar">
                    <tr>
                        <td align="center">
                            <asp:LinkButton ID="btnAddNew" runat="server" OnClick="btnAddNew_Click">
                                <asp:Label ID="lblAction" CssClass="Icon-32-Add" runat="server" />
                                Thêm mới
                            </asp:LinkButton>
                        </td>
                        <td align="center">
                            <asp:LinkButton ID="btnEdit" runat="server" OnClick="btnEdit_Click">
                                <asp:Label ID="Label1" CssClass="Icon-32-Edit" runat="server" />
                                Chỉnh sửa
                            </asp:LinkButton>
                        </td>
                        <td align="center">
                            <asp:LinkButton ID="btnDelete" runat="server" OnClick="btnDelete_Click" OnClientClick="return confirm('Bạn thực sự muốn xóa bản ghi này chứ?');">
                                <asp:Label ID="Label2" CssClass="Icon-32-Delete" runat="server" />
                                Xóa
                            </asp:LinkButton>
                        </td>
                        <td align="center">
                            <asp:LinkButton ID="btnActive" runat="server" OnClick="btnActive_Click">
                                <asp:Label ID="Label3" CssClass="Icon-32-Publish" runat="server" />
                                Hoạt động
                            </asp:LinkButton>
                        </td>
                        <td align="center">
                            <asp:LinkButton ID="btnInActive" runat="server" OnClick="btnInActive_Click">
                                <asp:Label ID="Label4" CssClass="Icon-32-UnPublish" runat="server" />
                                Không hoạt động
                            </asp:LinkButton>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
    <p align="center">
        <br />
        <asp:Label ID="lblMessage" runat="server" BackColor="White" BorderColor="White" ForeColor="Red"></asp:Label>
    </p>
    <div id="content-box">
        <div class="t">
            <div class="t">
                <div class="t">
                </div>
            </div>
        </div>
        <div class="m" style="height: 520px;">
            <table cellpadding="5" cellspacing="2" width="100%">
                <tr>
                    <td align="right">
                        <strong>Nhóm:</strong></td>
                    <td align="left">
                        <asp:DropDownList ID="ddlGroup" runat="server" Width="250px">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        <strong>Tình trạng:</strong></td>
                    <td align="left">
                        <asp:DropDownList ID="ddlStatus" runat="server" Width="136px">
                            <asp:ListItem Value="-1">--Tất cả--</asp:ListItem>
                            <asp:ListItem Value="1">Hoạt động</asp:ListItem>
                            <asp:ListItem Value="0">Không hoạt động</asp:ListItem>
                        </asp:DropDownList>
                        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                        <asp:ImageButton ID="ImgSearch" ImageUrl="../images/btnSearch.jpg" runat="server"
                            OnClick="ImgSearch_Click" />
                    </td>
                </tr>
            </table>
            <br />
            <asp:Label ID="lblGrid" runat="server" BackColor="White" BorderColor="White" ForeColor="Red"></asp:Label>
            <br />
            <table cellpadding="5" cellspacing="2" width="100%">
                <tr>
                    <td>
                        <ComponentArt:Grid ID="Grd1" EnableViewState="true" AllowEditing="true" EditOnClickSelectedItem="false"
                            ShowHeader="False" CssClass="Grid" KeyboardEnabled="false" FooterCssClass="GridFooter"
                            RunningMode="Callback" AutoCallBackOnDelete="true" AllowHtmlContent="true" PagerStyle="Numbered"
                            PagerTextCssClass="PagerText" PageSize="20" ImagesBaseUrl="../images/" LoadingPanelClientTemplateId="LoadingFeedbackTemplate"
                            Width="830" LoadingPanelPosition="MiddleCenter" runat="server">
                            <Levels>
                                <ComponentArt:GridLevel RowCssClass="Row" SelectedRowCssClass="SelectedRow" AlternatingRowCssClass="AlternatingRow"
                                    DataCellCssClass="DataCell" HeadingCellCssClass="HeadingCell" HeadingTextCssClass="HeadingCellText"
                                    SortAscendingImageUrl="asc.gif" SortDescendingImageUrl="desc.gif" SortImageWidth="9"
                                    SortImageHeight="5">
                                    <Columns>
                                        <ComponentArt:GridColumn Align="Center" DataCellClientTemplateId="chkTemplate" DataField="userId"
                                            HeadingText="<img src='../images/selected.gif' border='0' />" Width="40" AllowSorting="false" />
                                        <ComponentArt:GridColumn DataField="username" HeadingText="Tên đăng nhập" Width="100" />
                                        <ComponentArt:GridColumn DataField="fullname" HeadingText="Họ tên" Width="150" />
                                        <ComponentArt:GridColumn DataField="email" HeadingText="Email" Width="100" />
                                        <ComponentArt:GridColumn DataField="telephone" HeadingText="Điện thoại" Width="100" />
                                        <ComponentArt:GridColumn DataField="status" HeadingText="Hoạt động" Width="80" AllowSorting="false"
                                            DataCellClientTemplateId="StatusTemplate" />
                                        <ComponentArt:GridColumn DataField="userId" AllowSorting="false" HeadingText="Đổi mật khẩu"
                                            Width="90" DataCellServerTemplateId="ChangePassTemplate" EditControlType="EditCommand"
                                            Align="Center" />
                                        <ComponentArt:GridColumn DataField="userId" AllowSorting="false" HeadingText="Sửa"
                                            Width="40" DataCellServerTemplateId="EditTemplate" EditControlType="EditCommand"
                                            Align="Center" />
                                        <ComponentArt:GridColumn DataField="userId" AllowSorting="false" HeadingText="Xóa"
                                            Width="40" DataCellClientTemplateId="DeleteTemplate" EditControlType="EditCommand"
                                            Align="Center" />
                                    </Columns>
                                </ComponentArt:GridLevel>
                            </Levels>
                            <ClientTemplates>
                                <ComponentArt:ClientTemplate ID="chkTemplate" runat="server">
                                    <table width="100%" cellspacing="0" cellpadding="0" border="0">
                                        <tr>
                                            <td align="center" style="padding-left: 0px;">
                                                <input type="checkbox" class="checkbox" value="## DataItem.GetMember('userId').Value ##"
                                                    name="userId" id="userId" />
                                            </td>
                                        </tr>
                                    </table>
                                </ComponentArt:ClientTemplate>
                                <ComponentArt:ClientTemplate ID="StatusTemplate" runat="server">
                                    <table width="100%" cellspacing="0" cellpadding="0" border="0">
                                        <tr>
                                            <td align="center" style="padding-left: 5px;">
                                                ## if(DataItem.GetMember("status").Value == 1) { '<img src="../images/tick.png" border="0" />'
                                                } ## ## if(DataItem.GetMember("status").Value == 0) { '<img src="../images/publish_x.png"
                                                    border="0" />' } ##
                                            </td>
                                        </tr>
                                    </table>
                                </ComponentArt:ClientTemplate>
                                <ComponentArt:ClientTemplate ID="DeleteTemplate" runat="server">
                                    <a href="javascript:deleteRow('## DataItem.ClientId ##')" onclick="return confirm('Bạn thực sự muốn xóa bản ghi này chứ?');">
                                        <img src="../images/delete.gif" border="0" title="Xóa" /></a>
                                </ComponentArt:ClientTemplate>
                                <ComponentArt:ClientTemplate ID="LoadingFeedbackTemplate" runat="server">
                                    <table cellspacing="0" cellpadding="0" border="0">
                                        <tr>
                                            <td style="font-size: 10px;">
                                                Đang tải...&nbsp;</td>
                                            <td>
                                                <img src="../images/spinner.gif" border="0"></td>
                                        </tr>
                                    </table>
                                </ComponentArt:ClientTemplate>
                            </ClientTemplates>
                            <ServerTemplates>
                                <ComponentArt:GridServerTemplate ID="ChangePassTemplate" runat="Server">
                                    <Template>
                                        <a href="changePass.aspx?userId=<%# HttpUtility.UrlEncode(Common.DAL.Encrypt(Container.DataItem["userId"].ToString())) %>">
                                            <img src="../images/top_contacts.gif" border="0" title="Đổi mật khẩu" /></a>
                                    </Template>
                                </ComponentArt:GridServerTemplate>
                                <ComponentArt:GridServerTemplate ID="EditTemplate" runat="Server">
                                    <Template>
                                        <a href="userAE.aspx?Id=<%# HttpUtility.UrlEncode(Common.DAL.Encrypt(Container.DataItem["userId"].ToString())) %>">
                                            <img src="../images/edit.gif" border="0" title="Sửa" /></a>
                                    </Template>
                                </ComponentArt:GridServerTemplate>
                            </ServerTemplates>
                        </ComponentArt:Grid>
                    </td>
                </tr>
            </table>
            <div class="clr">
            </div>
        </div>
        <div class="b">
            <div class="b">
                <div class="b">
                </div>
            </div>
        </div>
    </div>
</asp:Content>
